package com.designpattern.singleton;

/**
 * 饿汉式单例。jvm保证类加载时，初始化时，静态块和静态变量赋值动作是线程安全的。
 * @author David
 *
 */
public class Singleton {

	private static final Singleton sigleton = new Singleton();
	
	private Singleton(){
		
	}
	
	public void print(){
		System.out.println("this is singleton.");
	}
	
	public static Singleton getInstance(){
		return sigleton;
	}
	
	
}
